﻿using PlaceOrder_Core.Models.QuanYi;
using PlaceOrder_Core.PlaceOrderModels;
using PlaceOrder_Shared.Models.Common;
using PlaceOrder_Shared.Models.Daily;
using PlaceOrder_Shared.Models.HengSheng;
using PlaceOrder_Shared.Models.KChartRelated;
using PlaceOrder_Shared.Models.Trade;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlaceOrder_Core.Services.Interfaces
{
    public interface IDailyData
    {
        public DailyData GetDailyData(string TsCode, TradeHistoryRow thr = null);

        public DailyDataPriceDiff GetPriceDiff(PriceDiff p);

        public List<TSInfoRow> GetAllTSInfo();

        public List<KChart> GetWindKChart(TSInfoRow ts, DateOnly qbdate);

        public void RepairMinuteKchartVolume(TSInfoRow ts);

        public void GetFirstMinuteKChartTime(string TsCode, ref DateTime dtTrade, bool NoForward);

        public void AddCheckList(CheckListModel cl);

        public decimal CalcCFactor(TSInfoRow ts, string CTDName);

        public bool AddShilianPriceDiff(int ShiLianPriceDiffID, List<KChart> charts);

        public DateOnly GetLastCBD10Y(Cbd10YPriceDiffList p);

        public bool UpdateKchart(string TsCode, KChart k);

        public void GetNetPrice(decimal yield, TSInfoRow ts, string dTrade, out decimal FullPrice, out decimal NetPrice);

        public void DeleteTradeDataByDate(string TsCode, DateOnly dtStart, bool NoForward);

        public void UpdateValuation(int iFlag, int Length, List<KChart> charts);

        public void DeletePriceDiffMinuteKchartByDate2(string name, DateOnly dtTrade, bool NoForward);

        public void DeletePriceDiffTradeDataByDate(PriceDiff p, DateOnly dtStart);

        public DateOnly GetFirstCrawlDate(string TsCode);

        public void GetFirstMinuteKChartTimeInPriceDiff2(string name, ref DateTime dtTrade, bool NoForward);

        public void GetFirstMinuteKChartTimeInPriceDiff(string name, ref DateTime dtTrade, bool NoForward);

        public void UpdatePriceDiffKChart2(TSInfoRow ts, PriceDiff p, List<KChart> charts);

        public void BondHelperSysLog(int UserID, string Action, long TargetID);

        public List<TradeSimUser> GetAllUsers();



        #region 客户端接口
        public List<TradeHistoryRow> GetTradeHistoryByDate(TSInfoRow ts, DateOnly dStart, DateOnly dEnd, bool NoForward = false);

        public List<string> GetAllTsCodes(bool Valid);

        public TSInfoRow GetBondByCode(string BondCode);

        public decimal GetLastClosePrice(TSInfoRow ts, bool NoForward = false, DateTime? dtStart = null);

        public  Task<List<BidHistory>> GetBidHistoriesAsync(string TsCode);

        public List<UserTradeVolumeConfig> GetUserTradeVolumeConfig(int UserID);//获取个人买量

        public bool AddUserTradeVolumeConfig(UserTradeVolumeConfig v);//写入个人买量

        public bool RemoveUserTradeVolumeConfig(UserTradeVolumeConfig v);//移除个人买量

        public bool UpdateUserTradeVolumeConfig(UserTradeVolumeConfig config);//更新个人买量

        public List<UserTrade> GetUserTrades(int UserID = 0);//获取个人交易

        public decimal GetLatestPrice(TSInfoRow ts, bool NoForward = false);//获取一个券的最新价格

        public TradeSimUser GetTradeSimSingleUser(int UserID);//获取交易员信息

        public List<QuanyiClientTradeClass> GetQuanyiSimulationTrades();//查看交易人员信息

        public void UpdateQuanyiSimUserDrawDown(TradeSimUser user); //计算回撤量用

        public List<ChatMessage> GetAllMessageDataByBrokerId(int brokerId, int userId = 0);//根据中介获取消息

        public string GetVersionId();
        #endregion

        #region 服务端接口
        public void TradeSimLog(QuanYiServerResponseClass qsr);
        public void TradeSimLog(QuanYiOrderServerResponseClass qsr);

        public bool AddUserTrade(UserTrade trade, out string msg);

        public bool UpdateUserTrade(UserTrade trade);//更新交易，改价用

        bool AddRequestReview(QuanYiOrderServerResponseClass qSR);//插入一条复议记录

        public List<ChatMessage> GetRecentMessagesByBrokerName(int brokerId, int number = 0);//根据中介来查找相关聊天记录

        void AddChatMessageList(int brokerId, List<ChatMessage> newChatMessages);//添加到服务端

        public void DelChatMessageList(int brokerId, DateTime dateStartTime, DateTime? dateEndTime = null);//根据更新时间删除指定聊天记录

        public void DelChatMessageListByCreateTime(int brokerId, DateTime? dateStartTime=null, DateTime? dateEndTime = null);//根据实际聊天记录时间删除指定聊天记录

        
        string GetChannelId();//获取通道ID

        #endregion

        #region 通用接口
        public List<Tsinfo> GetAllTsInfos();//获取所有券码

        public List<string> GetAllTsTypes();//获取所有券码

        public List<ChatReceiver> GetChatReceivers(int UserID = 0);

        public Task<List<ChatReceiver>> GetChatReceiversAsync(int UserID = 0);
        //public List<DateOnly> Holidays(); //获取假期
        #endregion

        #region 恒生相关
        public List<HengShengMarketInfo> GetHengShengMarketInfo();

        public List<TSInfoRow> GetTSInfoForHengSheng();

        public List<Setting> GetConfigs(string parameter);
        #endregion

        #region lily相关
        public int GetLilyTradeLimit(int UserID);
        List<ReviewMessage> GetAllReviewMessages(int UserID=0);//0就查所有的
 

        #endregion

    }
}
